-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Bluetooth: Host: Add legacy pairing test config #99742
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bluetooth: Host: Add legacy pairing test config #99742
Conversation
|
|
||
| config BT_SMP_ENFORCE_LEGACY_PAIRING | ||
| bool "Enforce legacy pairing" | ||
| depends on BT_TESTING |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it not allowed to only support legacy pairing in recent version of the core spec?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's allowed, but since Zephyr 3.0 the use of legacy pairing has been discouraged for being less/not secure, so I didn't want this Kconfig to imply otherwise. Zephyr-devices support legacy pairing with devices that do not support secure connections, but since Zephyr-devices do support it they will always default to this (and thus this config is needed to force it).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if we should allow setting this without BT_TESTING, but treat it as a warning for the above reasons. That would be similar to how we treat e.g. BT_USE_DEBUG_KEYS, where we have both Kconfig and CMake warnings if it's enabled.
Alternatively we should consider adding the same depends on BT_TESTING for things like BT_USE_DEBUG_KEYS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both suggestions are fine by me, do you have any thoughts @jhedberg?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think depends on BT_TESTING is the right way. BT_USE_DEBUG_KEYS should have it as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jhedberg Should we apply depends on BT_TESTING for all the other similar configs? And then if we do, should we remove the warning for them as well, and add/keep only a warning for BT_TESTING?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes sense to add the dependency on BT_TESTING to all relevant configs, keeping the warnings in the Kconfig file (but remove the CMakeList warnings and add a common one for BT_TESTING?).
Adds the `CONFIG_BT_SMP_LEGACY_PAIR_ONLY` Kconfig option to force devices to use legacy pairing. This has a dependency on `CONFIG_BT_TESTING` as it is only intended for testing purposes, and use of legacy pairing is discouraged. Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
dba8951 to
ce2bf26
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds the CONFIG_BT_SMP_LEGACY_PAIR_ONLY Kconfig option to enable testing of legacy Bluetooth pairing between Zephyr devices. The option forces devices to use legacy pairing instead of defaulting to Secure Connections pairing.
Key Changes:
- New test-only Kconfig option with appropriate dependencies on
CONFIG_BT_TESTINGand mutual exclusion with Secure Connections modes - Updates to SMP authentication default flags to exclude Secure Connections when legacy pairing is forced
- Modification to
le_sc_supported()function to return false when the new config is enabled
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| subsys/bluetooth/host/Kconfig | Adds CONFIG_BT_SMP_LEGACY_PAIR_ONLY option with proper dependencies and clear documentation for testing purposes |
| subsys/bluetooth/host/smp.c | Updates macro definitions and le_sc_supported() function to disable Secure Connections support when legacy pairing is forced |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.



Adds the
CONFIG_BT_SMP_LEGACY_PAIR_ONLYKconfig option to force devices to use legacy pairing. This has a dependency onCONFIG_BT_TESTINGas it is only intended for testing purposes, and use of legacy pairing is discouraged.